object fImportXLS: TfImportXLS
  Left = 554
  Top = 271
  BorderIcons = [biSystemMenu]
  BorderStyle = bsDialog
  Caption = #1048#1084#1087#1086#1088#1090' '#1091#1088#1086#1082#1086#1074' '#1080#1079' Excel'
  ClientHeight = 304
  ClientWidth = 352
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  OnCreate = FormCreate
  DesignSize = (
    352
    304)
  PixelsPerInch = 96
  TextHeight = 13
  object bLoadFile: TButton
    Left = 8
    Top = 8
    Width = 335
    Height = 21
    Anchors = [akLeft, akTop, akRight]
    Caption = #1047#1072#1075#1088#1091#1079#1080#1090#1100' XLS'
    TabOrder = 0
    OnClick = bLoadFileClick
  end
  object mLog: TMemo
    Left = 8
    Top = 48
    Width = 335
    Height = 246
    Anchors = [akLeft, akTop, akRight, akBottom]
    ReadOnly = True
    ScrollBars = ssVertical
    TabOrder = 1
  end
  object cbClear: TCheckBox
    Left = 8
    Top = 32
    Width = 209
    Height = 17
    Caption = #1054#1095#1080#1097#1072#1090#1100' '#1079#1072#1075#1088#1091#1078#1072#1077#1084#1099#1077' '#1082#1091#1088#1089#1099
    Checked = True
    State = cbChecked
    TabOrder = 2
  end
  object bFix: TButton
    Left = 198
    Top = 32
    Width = 145
    Height = 17
    Caption = #1048#1089#1087#1088#1072#1074#1080#1090#1100' '#1085#1072#1079#1074#1072#1085#1080#1103
    TabOrder = 3
    OnClick = bFixClick
  end
  object db: TpFIBDatabase
    AutoReconnect = True
    DBName = 'localhost:C:\base\OLYMPICBASE.FDB'
    DBParams.Strings = (
      'user_name=vminich'
      'password=kotosh'
      'lc_ctype=WIN1251'
      'sql_role_name=CANWR')
    DefaultTransaction = tr
    DefaultUpdateTransaction = trU
    SQLDialect = 3
    Timeout = 0
    WaitForRestoreConnect = 0
    Left = 16
    Top = 176
  end
  object tr: TpFIBTransaction
    DefaultDatabase = db
    TimeoutAction = TARollback
    Left = 56
    Top = 176
  end
  object trU: TpFIBTransaction
    DefaultDatabase = db
    TimeoutAction = TARollback
    Left = 56
    Top = 224
  end
  object qGetSubject: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'SELECT SDID FROM SYS_DIC '
      'WHERE SDPARID = 35'
      '  AND SDNAME = :SUBJECTNAME'
      '  AND SDISDELETE = 0')
    Left = 104
    Top = 40
    qoStartTransaction = True
  end
  object qAddSubject: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'INSERT INTO SYS_DIC (SDID, SDPARID, SDNAME, SDISDELETE)'
      'VALUES (GEN_ID(gen_sys_dic,1), 35, :SUBJECTNAME, 0)'
      'RETURNING SDID')
    Left = 176
    Top = 40
    qoStartTransaction = True
  end
  object qGetUcheb: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select iduchebkurs'
      'from uchebkurs'
      'where IDPREDMET = :SUBJECT_ID'
      '  and CUCHEBKURS = :KURSNAME'
      '  and UISDELETE is null')
    Left = 104
    Top = 96
    qoStartTransaction = True
  end
  object qAddUcheb: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'INSERT INTO UCHEBKURS (IDUCHEBKURS, IDPREDMET, CUCHEBKURS)'
      'VALUES (GEN_ID(gen_uchebkurs_id,1), :SUBJECT_ID, :KURSNAME)'
      'RETURNING IDUCHEBKURS')
    Left = 168
    Top = 96
    qoStartTransaction = True
  end
  object qGetTema: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select idtemauk'
      'from temauk'
      'where iduchebkurs = :KURS_ID'
      '  and tema = :TEMANAME'
      '  and tisdelete is null')
    Left = 104
    Top = 152
    qoStartTransaction = True
  end
  object qAddTema: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'INSERT INTO temauk (idtemauk, iduchebkurs, tema)'
      'VALUES (GEN_ID(gen_temauk_id,1), :KURS_ID, :TEMANAME)'
      'RETURNING idtemauk')
    Left = 168
    Top = 152
    qoStartTransaction = True
  end
  object qAddLesson: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      
        'INSERT INTO PODTEMAUK (IDPODTEMAUK, IDTEMAUK, PODTEMA, NUMUK, NU' +
        'MTEMA, KOLTIME)'
      
        'VALUES (GEN_ID(gen_podtemauk_id,1), :TEMA_ID, :PODTEMA_NAME, :NU' +
        'MUK, :NUMTEMA, 1)'
      'returning idpodtemauk')
    Left = 176
    Top = 184
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object qGetLesson: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select IDPODTEMAUK'
      'from PODTEMAUK'
      'where IDTEMAUK = :TEMA_ID'
      '  and PODTEMA = :PODTEMA_NAME'
      '  and NUMUK = :NUMUK'
      '  and pisdelete is null')
    Left = 112
    Top = 184
    qoStartTransaction = True
  end
  object ac: TADOConnection
    Left = 224
    Top = 88
  end
  object ads: TADODataSet
    Connection = ac
    Parameters = <>
    Left = 224
    Top = 144
  end
  object dXLS: TOpenDialog
    DefaultExt = '.xls'
    Filter = #1050#1085#1080#1075#1072' Excel 97-2003 (*.xls)|*.xls'
    Options = [ofReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
    OptionsEx = [ofExNoPlacesBar]
    Left = 48
    Top = 56
  end
  object qDeleteKurs: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'execute procedure PTP_DELETE_KURS(:KURS_ID)')
    Left = 264
    Top = 56
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object qDoubles: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select'
      '  distinct'
      '  p.idtemauk,'
      '  p.idpodtemauk,'
      '  p.podtema'
      'from PODTEMAUK p'
      'join podtemauk d on p.idtemauk = d.idtemauk'
      
        '  and ((p.podtema = d.podtema) OR (p.podtema || '#39'.'#39' = d.podtema)' +
        ' OR (d.podtema || '#39'.'#39' = p.podtema))'
      '  and p.idpodtemauk != d.idpodtemauk'
      '  and p.pisdelete is null'
      '  and d.pisdelete is null'
      'order by 1,3,2')
    Left = 264
    Top = 200
    qoStartTransaction = True
  end
  object qDoubleFix: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'update PODTEMAUK'
      'set podtema = :PODTEMA'
      'where idpodtemauk = :PODTEMAID')
    Left = 264
    Top = 248
    qoStartTransaction = True
  end
  object qGetElement: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select IDELEMENTP'
      'from ELEMENTP'
      'where IDPODTEMAUK = :IDPODTEMAUK'
      '  and ELEMENTP = :ELEMENTP'
      '  and eisdelete is null')
    Left = 112
    Top = 232
    qoStartTransaction = True
  end
  object qAddElement: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'INSERT INTO ELEMENTP (IDELEMENTP, IDPODTEMAUK, ELEMENTP)'
      'VALUES (GEN_ID(gen_ELEMENTP_id,1), :IDPODTEMAUK, :ELEMENTP)'
      'returning IDELEMENTP')
    Left = 176
    Top = 232
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object qGetTask: TpFIBQuery
    Transaction = tr
    Database = db
    SQL.Strings = (
      'select IDLEARNTASK'
      'from LEARNTASK'
      'where IDELEMENTP = :IDELEMENTP'
      '  and LEARNTASK = :LEARNTASK'
      '  and lisdelete is null')
    Left = 24
    Top = 248
    qoStartTransaction = True
  end
  object qAddTask: TpFIBQuery
    Transaction = trU
    Database = db
    SQL.Strings = (
      'INSERT INTO LEARNTASK (IDLEARNTASK, IDELEMENTP, LEARNTASK)'
      'VALUES (GEN_ID(gen_LEARNTASK_id,1), :IDELEMENTP, :LEARNTASK)'
      'returning IDLEARNTASK')
    Left = 80
    Top = 256
    qoAutoCommit = True
    qoStartTransaction = True
  end
end
